/**
 * @ClassName LC3142
 * @Author ykx
 * @Date 2024/7/13 8:22
 * @Version 1.0
 */
public class LC3142 {
    public static void main(String[] args) {
        LC3142 lc3142 = new LC3142();
        System.out.println(lc3142.satisfiesConditions(new int[][]{{1}, {2}, {3}}));
    }

    public boolean satisfiesConditions(int[][] grid) {
        for (int i = 0; i < grid.length; i++) {
            for (int j = 0; j < grid[i].length; j++) {
                if (i < grid.length - 1 && grid[i][j] != grid[i + 1][j]) {
                    return false;
                }
                if (j < grid[i].length - 1 && grid[i][j] == grid[i][j + 1]) {
                    return false;
                }
            }
        }
        return true;
    }
}
